Copyright(C) 1994,1995,1996,1997 Terumasa KODAKA, Takeshi KONO
■98MULTi       CanBe control
Target         PC-9821Cf・Cx・Cb・Cx2・Cb2・Cx3・Cb3・Na12・Na9・Na7・Nb7・Nx
Description  o The 98MULTi CanBe has special I/O ports to control various multimedia
               functions. This I/O is mainly used to control the remote control,
               control sound functions, turn off the power, etc. Also, the PC-9821Na7/Nx,
               which is a multimedia-oriented 98NOTE, is based on the 98MULTi CanBe and
               has similar I/O. o Normally this I/O address can be relocated by I/O
               0C24h, 0C2Bh, 0C2Dh. Usually set to I/O 0F4Ah,0F4Bh.
             o When there is a reception from the remote control, an interrupt is
               generated to the CPU. The CPU can monitor the status of the remote
               control by hooking this interrupt.
             o Perform power-off processing. PC-9821Cf/Cx/Cb/Cx2/Cb2/Cx3/Cb3 does not
               support power off using INT 1Fh - Function 98h, so it is necessary to
               directly operate the hardware to turn off the power.
Related I/O    0C24h,0C2Bh,0C2Dh
I/O            0F4Ah
Name           Remote control control [INDEX]
Function       bit 7~0: Register specification
                       * Specify the register number to read/write with I/O 0F4Bh
Related        I/O 0F4Bh
I/O            0C24h,0C2Bh,0C2Dh
I/O            0F4Bh
Name           Remote control control [DATA]
Function       bit 7~0: Data specification
                       * Read and write the register specified by I/O 0F4Ah.
               --------+--------------------------------------------------------------
               INDEX   | Usage
               --------+--------------------------------------------------------------
               00h     | Unknown
               --------+--------------------------------------------------------------
               01h     | Sound interrupt address
                       | [READ/WRITE]
                       |          00h=INT5
                       |          02h=INT41
                       |          03h=INT0
                       |          08h=INT1
                       |          * The interrupt address used by WindowsSoundSystem is set
                       | Related  I/O 0F40h bit 5~3
               --------+--------------------------------------------------------------
               02h     | Unknown
               --------+--------------------------------------------------------------
               03h     | Remote control reset
                       | [READ/WRITE]
                       |   bit 7~3: unknown
                       |   bit 2: Microphone through
                       |          1=Mic through
                       |          0=Do not use microphone through
                       |   bit 1: unknown
                       |   bit 0: Controller reset
                       |          1=Reset
                       |          0=Do not reset
               --------+--------------------------------------------------------------
               04h     | Mute control
                       | [READ/WRITE]
                       |   bit 7~1: unknown
                       |   bit 0: Mute
                       |          1=mute
                       |          0=Do not mute
                       |          * Control muting of sound output
               --------+--------------------------------------------------------------
               10h     | Remote control data status
                       | [READ]
                       |   bit 7~2: Unused
                       |   bit 1: Busy flag
                       |          1=Reday
                       |          0=Busy
                       |   bit 0: Status
                       |          1=Receive data available
                       |          0=No data received
                       |          * It is set when data is received from the remote control
                       |            and generates an interrupt to the CPU.
                       |            I/O 0F4Ah,0F4Bh - Cleared by taking the receive code 2
                       |            bytes from 11h.
               --------+--------------------------------------------------------------
               11h     | Remote control reception code
                       | [READ]
                       |        00000000b(00h)= Pressed [^](Ch UP)
                       |        11111111b(FFh)= Read second time after pressing [^](Ch UP)
                       |        00000001b(01h)= Pressed [v](Ch DOWN)
                       |        11111111b(FEh)= Read second time after pressing [v](Ch DOWN)
                       |        00000010b(02h)= [^](VOL UP) was pressed
                       |        11111101b(FDh)= Read second time after pressing [^](VOL UP)
                       |        00000011b(03h)= Pressed [V](VOL DOWN)
                       |        11111100b(FCh)= Read after pressing [V](VOL DOWN)
                       |        00000100b(04h)= [^](EJECT) was pressed
                       |        11111011b(FBh)= Read second time after pressing [^](EJECT)
                       |        00000101b(05h)= [》||] pressed
                       |        11111010b(FAh)= Read second time after pressing [》||]
                       |        00001001b(09h)= [MUTE] pressed
                       |        11110110b(F6h)= Read second time after pressing [MUTE]
                       |        00001010b(0Ah)= [VIDEO] pressed
                       |        11110101b(F5h)= Read second time after pressing [VIDEO]
                       |        00001100b(0Ch)= [>>] pressed
                       |        11110011b(F3h)= Read second time after pressing [>>]
                       |        00001101b(0Dh)= [<<] pressed
                       |        11110010b(F2h)= Read second time after pressing [<<]
                       |        00011101b(1Dh)= Pressed [MAIN/SUB]
                       |        11100010b(E2h)= Read second time after pressing [MAIN/SUB]
                       |        01000000b(40h)= Pressed [↑]
                       |        10111111b(BFh)= Read second time after pressing [↑]
                       |        01000001b(41h)= Pressed [↓]
                       |        10111110b(BEh)= Read second time after pressing [↓]
                       |        01000010b(42h)= [←] pressed
                       |        10111101b(BDh)= Read second time after pressing [←]
                       |        01000011b(43h)= Pressed [→]
                       |        10111100b(BCh)= Read second time after pressing [→]
                       |        01001101b(4Dh)= [SIZE] pressed
                       |        10110010b(B2h)= Read second time after pressing [SIZE]
                       |        01001110b(4Eh)= [ESC] pressed
                       |        10110001b(B1h)= Read second time after pressing [ESC]
                       |        01001111b(4Fh)= [CR] pressed
                       |        10110000b(B0h)= Read second time after pressing [CR]
                       |        01010011b(53h)= Pressed [TV]
                       |        10101100b(ACh)= Read second time after pressing [TV]
                       |        01011011b(5Dh)= Pressed [FREEZE]
                       |        10100010b(A2h)= Read second time after pressing [FREEZE]
                       |        01011110b(5Eh)= [CAPTURE] pressed
                       |        10100001b(A1h)= Read second time after pressing [CAPTURE]
                       |        * The reception code from the remote control is obtained in the form
                       |          of a code number assigned to each button.
                       |        * Each code reads two bytes consecutively. In the second byte, the
                       |          bit-inverted value of the first byte is read.
               --------+--------------------------------------------------------------
               12h     | Unknown
               --------+--------------------------------------------------------------
               13h     | Power control
                       | [WRITE]
                       |   80h,06h,00h,00h,80h,07h,00h,01h,80h,01h,00h,00h
                       |   * Writing this byte string will turn off the power.
                       |
                       |   80h,05h,00h,00h
                       |   * This byte string is written when the power is turned on.
               --------+--------------------------------------------------------------
               14h     | ■[CANBE]
                       | Interrupts used by the remote control
                       | [READ/WRITE]
                       |   bit 7~3: unknown
                       |   bit 2: Remote control interrupt
                       |          1=not used
                       |          0=use
                       |   bit 1,0: Remote control interrupt address
                       |            11b=INT41
                       |            10b=INT1
                       |            01b=INT2
                       |            00b=INT0
                       | * Set the interrupt address etc. used by the remote control.
                       +--------------------------------------------------------------
                       | ■[PC-9821Nx]
                       | Unknown
               --------+--------------------------------------------------------------
               30h     | CanBe VOL1・2(YMF288 output) L
               --------+--------------------------------------------------------------
               31h     | CanBe VOL1・2(YMF288 output) R
               --------+--------------------------------------------------------------
               32h     | CanBe VOL3・4(LINE input) L
               --------+--------------------------------------------------------------
               33h     | CanBe VOL3・4(LINE input) R
               --------+--------------------------------------------------------------
               34h     | Unknown
               --------+--------------------------------------------------------------
               35h     | Unknown
               --------+--------------------------------------------------------------
Related        I/O 0F4Ah
               I/O 0C24h,0C2Bh,0C2Dh
-------------------------------------------------------------------------------
■TV tuner board
Target         PC-9821Cf・Cx・Cb
Description  o The PC-9821Cf, Cx, and Cb come standard with a dedicated TV
               tuner board for capturing and overlaying TV images.
Related        INT 0Eh
I/O 0960h
Name           TV tuner control [DATA]
               Undocumented
Function       [READ/WRITE]
               bit 15~0: data
                 ---------+------------------------------------------------------
                 register | content
                 ---------+------------------------------------------------------
                 0000h    |Freeze settings
                          |bit 15~1: unknown
                          |bit 0: Freeze
                          | 1=Freeze
                          | 0=do not freeze
                 ---------+------------------------------------------------------
                 0001h    | Unknown
                 ---------+------------------------------------------------------
                 0002h    | Unknown
                 ---------+------------------------------------------------------
                 0003h    | Capture range specification
                          | bit 15~0: Screen X coordinate
                 ---------+------------------------------------------------------
                 0004h    | Capture range specification
                          | bit 15~0: Screen Y coordinate
                 ---------+------------------------------------------------------
                 0005h    | Capture range specification
                          | bit 15~0: Screen X size
                 ---------+------------------------------------------------------
                 0006h    | Unused
                 0007h    | Unused
                 ---------+------------------------------------------------------
                 0008h    | Unknown X size
                 ---------+------------------------------------------------------
                 0009h    | Unknown X size
                 ---------+------------------------------------------------------
                 000Ah    | Unknown Y size
                 ---------+------------------------------------------------------
                 000Bh    | Unknown Y size
                 ---------+------------------------------------------------------
                 000Ch    | Unused
                 ---------+------------------------------------------------------
                 000Dh    | Unknown
                 ---------+------------------------------------------------------
                 000Eh    | Unused
                 000Fh    | Unused
                 ---------+------------------------------------------------------
                 0010h    | Unknown
                 ---------+------------------------------------------------------
                 0011h    | Display position
                          | bit 15~10: Unused
                          | bit 9~0: Screen display position (X coordinate)
                 ---------+------------------------------------------------------
                 0012h    | Display position
                          | bit 15~10: Unused
                          | bit 9~0: Screen display position (Y coordinate)
                 ---------+------------------------------------------------------
                 0013h    | Capture start position (dot number)
                 ---------+------------------------------------------------------
                 0014h    | Capture start position (line number)
                 ---------+------------------------------------------------------
                 0015h    | Display position
                          | bit 15~10: Unused
                          | bit 9~0: Screen display position (X coordinate)
                 ---------+------------------------------------------------------
                 0016h    | Display position
                          | bit 15~10: Unused
                          | bit 9~0: Screen display position (Y coordinate)
                 ---------+------------------------------------------------------
                 0017h    | Right side mask start position
                          | bit 15~10: Unused
                          | bit 9~0: Mask start position (X coordinate)
                 ---------+------------------------------------------------------
                 0018h    | Lower mask start position
                          | bit 15~10: Unused
                          | bit 9~0: Mask start position (Y coordinate)
                 ---------+------------------------------------------------------
                 0019h    |
                   :      | Unused
                 001Fh    |
                 ---------+------------------------------------------------------
                 0020h    | Unknown
                 ---------+------------------------------------------------------
                 0021h    | Voice control
                          | bit 15~4: unused
                          | bit 3,2: Audio mute
                          |   11b=Mute
                          |   10b=Mute
                          |   01b=Do not mute
                          |   00b=Mute
                          | bit 1,0: unknown
                 ---------+------------------------------------------------------
Description    o Read and write the register specified by I/O 0962h.
Related          I/O 0962h
I/O              0962h
Name             TV tuner control [INDEX]
                 Undocumented
Function         [READ/WRITE]
                 bit 15~0: Register specification
Description    o Specify the register number to read/write with I/O 0960h.
               o It is possible to detect the presence of a video capture board by
                 checking whether 0000h can be read normally when reading immediately after
                 writing 0000h to this port.
Related          I/O 0960h
I/O              0964h
Name             Capture data
                 Undocumented
Function         [READ]
                 bit 15~0: data
                 * Capture data collection
Explanation o    Retrieve the captured data.
Related          I/O 0962h,0960h
I/O              0966h
Name             Unknown
                 Undocumented
Function         [READ/WRITE]
                 bit 7~0: unknown
Explanation    o Details unknown
Related          I/O 0967h
I/O              0967h
Name             Unknown
                 Undocumented
Function         [READ/WRITE]
                 bit 7~0: unknown
Explanation o    Details unknown
Related          I/O 0966h